tg-me.com/java_codings/7
Last Update:
4. Program to Accept value of Radius and Calculate Area of Circle.
class CalculateCircleAreaExample
{
public static void main(String[] args)
{
int radius = 3;
System.out.println("The radius of the circle is " + radius);
/*
* Area of a circle is pi * r * r where r is a radius of a circle.
*/
// NOTE : use Math.PI constant to get value of pi
double area = Math.PI * radius * radius;
System.out.println("Area of a circle is " + area);
}
}
@java_codings
BY Advance Java π¨βπ»
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
Share with your friend now:
tg-me.com/java_codings/7